package com.cloudkinto.common.exception;

import com.cloudkinto.common.error.BaseErrorInfoInterface;
import com.cloudkinto.common.error.ErrorEnum;

import java.io.Serializable;

/**
 * @author zhangyy
 * @date 2020/7/27 14:52
 * @description: 余额不足异常
 */
public class NotSufficientFundsException extends RuntimeException implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 错误码
     */
    private String errorCode = ErrorEnum.NOT_SUFFICIENT_FUNDS.getResultCode();
    /**
     * 错误信息
     */
    private String errorMsg;

    public NotSufficientFundsException(){
        super();
    }

    public NotSufficientFundsException(String errorMsg) {
        super(errorMsg);
        this.errorMsg = errorMsg;
    }

    public NotSufficientFundsException(BaseErrorInfoInterface errorInfoInterface) {
        super(errorInfoInterface.getResultMsg());
        this.errorCode = errorInfoInterface.getResultCode();
        this.errorMsg = errorInfoInterface.getResultMsg();
    }

    public NotSufficientFundsException(BaseErrorInfoInterface errorInfoInterface, Throwable cause) {
        super(errorInfoInterface.getResultMsg(), cause);
        this.errorCode = errorInfoInterface.getResultCode();
        this.errorMsg = errorInfoInterface.getResultMsg();
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
}
